package com.lcj.controller;

import com.lcj.entity.bo.HeadLine;
import lombok.extern.slf4j.Slf4j;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author：LCJ
 * @Description：
 * @Date：Create in 17:38 2021/4/30 0030
 */
@Slf4j
@WebServlet("/hello")
public class hello extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name ="我的框架";
        log.debug("name is "+ name);
        req.setAttribute("name",name);
        System.out.println("我成功来了");
        req.getRequestDispatcher("/WEB-INF/jsp/hello.jsp").forward(req,resp);
        HeadLine headLine =new HeadLine();
        headLine.setLineId(1l);
        headLine.getLineId();
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }

    @Override
    public void destroy() {
       System.out.println("destroy");
    }

    @Override
    public void init() throws ServletException {
        System.out.println("init");
    }

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("我是入口");
        doGet(req,resp);
    }
}
